<template>
    <el-container>
        <el-main>
            <!-- 列表-->
            <avue-crud ref="multipleTable" :data="tableData" :option="tableColumns" :page="page" @refresh-change="refresh"
                @size-change="sizeChange" @current-change="currentChange" @filter-change="filterChange" @search-change="searchChange"
                @search-reset="searchReset">
                <template slot="menuLeft">
                    <el-button v-for="(item,index) in toolbar" :key="index" :type="item.type" :class="item.hide?'hide':''"
                        @click.native="btnclick(item.funName)" size="small">{{ item.label }}</el-button>
                </template>
                <template slot="menu" slot-scope="{row}">
                    <el-button size="small" type="text" class="primarybtn-color" @click.native="jobEdited(row)">
                        编辑
                    </el-button>
                    <span v-for="(item,index) in optbar" :key="index" style="margin-left: 10px;">
                        <el-button size="small" v-if="item.funName !== 'jobPrinted'" type="text" :class="item.type"
                            @click.native="btnclick(item.funName, row)">
                            {{ item.label }}
                        </el-button>
                        <el-dropdown trigger="click" v-if="item.funName === 'jobPrinted' && prints.length > 0" style="font-size: 12px;cursor: pointer;margin-right: 10px;">
                            <span class="el-dropdown-link" style="color: #409EFF;">{{ item.label }}</span>
                            <el-dropdown-menu slot="dropdown">
                                <el-dropdown-item v-for="(pritem, prindex) in prints" :key="prindex" @click.native="jobPrinted(row, pritem.uuId)">
                                    {{pritem.birtName}}
                                </el-dropdown-item>
                            </el-dropdown-menu>
                        </el-dropdown>
                    </span>
                    <el-button size="small" type="text" class="primarybtn-color" @click.native="jobViewed(row)">
                        查看
                    </el-button>
                    <el-button size="small" type="text" class="primarybtn-color" @click.native="jobCharted(row)">
                        查看流程
                    </el-button>
                </template>
            </avue-crud>

            <!-- 业务表单窗口-->
            <el-dialog :destroy-on-close="false" :close-on-click-modal="false" :visible.sync="jobVisible" :before-close="handleCloseBindJob"
                fullscreen>
                <avue-form v-if="jobHackReset" ref="form" v-model="jobObj" :option="jobOption">
                </avue-form>
                <el-row slot="title">
                    {{jobTitle}}
                    <el-divider direction="vertical"></el-divider>
                    <span v-if="jobFormConfigs.length === 1">{{jobCurrentConfig.formName}}</span>
                    <el-select style="margin-top: -10px;width: 200px;" v-if="jobFormConfigs.length > 1" v-model="jobCurrentConfig.formId"
                        @change="jobFormChange">
                        <el-option v-for="item in jobFormConfigs" :key="item.formId" :label="item.formName" :value="item.formId">
                        </el-option>
                    </el-select>
                </el-row>
                <el-row slot="footer" class="dialog-footer" style="text-align: center;">
                    <el-button v-if="jobViewTag === 1 && jobFormConfigs.length > 0" size="small" type="primary" @click="jobProcessSaveOrSubmit(0)">保存</el-button>
                    <el-button v-if="jobViewTag === 1 && jobFormConfigs.length > 0" size="small" type="danger" @click="jobProcessSaveOrSubmit(1)">保存&提交</el-button>
                    <el-button v-if="jobViewTag === 1" size="small" @click="handleCloseBindJob">关闭</el-button>
                    <el-button v-if="jobViewTag === 0" size="small" @click="jobVisible = false;">关闭</el-button>
                </el-row>
            </el-dialog>

            <!-- 审核弹窗-->
            <el-dialog :title="examTitle" :destroy-on-close="false" :close-on-click-modal="false" :visible.sync="examVisible"
                :before-close="handleCloseBindExam" width="650px">
                <div style="height:25vh;overflow:auto">
                    <el-form :model="examForm" :rules="examRules" ref="examForm">
                        <el-form-item prop="examResult" label="审核结果" :label-width="examFormLabelWidth">
                            <el-select v-model="examForm.examResult" placeholder="请选择审核结果">
                                <el-option label="请选择" value=""></el-option>
                                <el-option v-for="(item, index) in examResSelection" :key="index" :label="item.label"
                                    :value="item.value"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item v-if="examForm.examResult === '2'" prop="examReback" label="回退节点" :label-width="examFormLabelWidth">
                            <el-select v-model="examForm.examReback" placeholder="请选择回退节点">
                                <el-option label="请选择" value=""></el-option>
                                <el-option v-for="(item, index) in examRebackSelection" :key="index" :label="item.label"
                                    :value="item.value"></el-option>
                            </el-select>
                        </el-form-item>
                        <el-form-item prop="examReason" label="审核意见" :label-width="examFormLabelWidth">
                            <el-input type="textarea" v-model="examForm.examReason"></el-input>
                        </el-form-item>
                    </el-form>
                </div>
                <el-row slot="footer" class="dialog-footer" style="text-align: center;">
                    <el-button size="small" type="primary" @click="jobExamedSaveOrSubmit(0)">审核</el-button>
                    <el-button size="small" type="danger" @click="jobExamedSaveOrSubmit(1)">审核&提交</el-button>
                    <el-button size="small" @click="examVisible = false;">取消</el-button>
                </el-row>
            </el-dialog>
        </el-main>
    </el-container>
</template>

<script>
    import {
        api
    } from "@/api/common";

    export default {
        data() {
            return {
                // 业务列表
                flowId: '',
                nodeId: '',
                page: {
                    // pageSizes: [5, 10, 20, 30, 40],
                    currentPage: 1,
                    total: 0,
                    pageSize: 10
                },
                toolbar: [],
                optbar: [],
                prints: [],
                tableData: [],
                searchForm: {},
                filterForm: {
                    search: {}
                },
                tableColumns: {
                    border: true,
                    stripe: false,
                    showHeader: true,
                    index: false,
                    page: true,
                    align: 'left',
                    menuAlign: 'center',
                    addBtn: false,
                    delBtn: false,
                    editBtn: false,
                    menu: true,
                    columnBtn: false,
                    searchMenuSpan: 4,
                    filterBtn: true,
                    column: []
                },
                // 业务表单
                jobVisible: false,
                jobTitle: '',
                jobRow: {},
                jobObj: {},
                jobOption: {
                    emptyBtn: false,
                    submitBtn: false
                },
                jobViewTag: 0,
                jobHackReset: true,
                jobCurrentConfig: {},
                jobFormConfigs: [],

                // 审核
                examVisible: false,
                examTitle: '',
                examFormLabelWidth: '100px',
                examRow: {},
                examForm: {
                    examResult: '',
                    examReback: '',
                    examReason: '',
                },
                examResSelection: [],
                examRebackSelection: [],
                examRules: {
                    examResult: {
                        required: true,
                        message: '审核结果不能为空',
                        trigger: 'blur'
                    },
                    examReback: {
                        required: true,
                        message: '回退节点不能为空',
                        trigger: 'blur'
                    },
                    examReason: {
                        required: true,
                        message: '审核意见不能为空',
                        trigger: 'blur'
                    },
                },
            }
        },
        watch: {
            "$route": function(to, from) {
                if (to.path != from.path) {
                    let path = this.$route.path
                    this.flowId = path.split("/")[3]
                    this.nodeId = path.split("/")[4]
                    // this.flowId = to.params.flowId
                    // this.nodeId = to.params.nodeId
                    this.getWorkFlowTodoConfig()
                    this.getTableList()
                }
            }
        },
        created() {
            let path = this.$route.path
            this.flowId = path.split("/")[3]
            this.nodeId = path.split("/")[4]
            // this.flowId = this.$route.params.flowId
            // this.nodeId = this.$route.params.nodeId
            this.getWorkFlowTodoConfig()
            this.getTableList()
        },
        methods: {
            getWorkFlowTodoConfig() {
                let params = {
                    flowId: this.flowId,
                    nodeId: this.nodeId
                }
                let _this = this
                _this.axios.post(api.getWorkFlowTodoConfig, params).then((res) => {
                    if (res.data.code == 10000) {
                        _this.tableColumns.column = res.data.data.gridColumns
                        _this.toolbar = res.data.data.gridBtns.toolbar
                        _this.optbar = res.data.data.gridBtns.optbar
                        _this.prints = res.data.data.gridBtns.prints
                        console.log(_this.prints)
                    }
                }).catch((err) => {
                    console.log('调用失败', err)
                })
            },
            searchChange(params, done) {
                this.page.currentPage = 1
                this.getTableList(params)
                Object.assign(this.searchForm, params)
                done()
            },
            searchReset() {
                this.page.currentPage = 1
                this.$set(this.searchForm, 'keyword', '')
                this.getTableList()
            },
            // 分页
            sizeChange(val) {
                this.page.currentPage = 1
                this.page.pageSize = val
                this.getTableList()
            },
            // 当前页
            currentChange(val) {
                this.page.currentPage = val
                this.getTableList()
            },
            // 刷新
            refresh() {
                this.getTableList()
            },
            filterChange(result) {
                this.filterForm.search = result
                this.getTableList(this.filterForm.search)
            },
            // 获取表格数据
            getTableList(where) {
                let params = {
                    page: this.page.currentPage,
                    limit: this.page.pageSize,
                    flowId: this.flowId,
                    nodeId: this.nodeId
                }
                params = Object.assign({}, params, this.searchForm)
                params = Object.assign({}, params, this.filterForm)
                if (where) {
                    params = Object.assign({}, params, where)
                }

                let _this = this
                _this.axios.post(api.getJobTodoList, params).then((res) => {
                    if (res.data.code == 10000) {
                        _this.tableData = res.data.data.list
                        _this.page.total = res.data.data.count
                    } else {
                        _this.tableData = []
                        _this.page.total = 0
                        _this.$message({
                            showClose: false,
                            message: res.data.message,
                            type: 'error'
                        });
                    }
                }).catch((err) => {
                    _this.tableData = []
                    _this.page.total = 0
                    console.log('调用失败', err)
                })
            },
            // 按钮点击（转发）
            btnclick(func, row = 0) {
                this[func](row)
            },
            // 创建
            async jobCreated() {
                let msgTitle = '新建';
                let _this = this
                _this.jobViewTag = 1
                // 获取表单配置信息
                _this.getJobFormDefaultConfig(_this.flowId, _this.nodeId, msgTitle)
            },
            // 审核
            async jobExamed(row) {
                let _this = this
                _this.axios.post(api.getJobExamDetail, {
                    processId: row.processId,
                    jobId: row.jobId,
                    flowId: row.flowId,
                    nodeId: row.nodeId,
                }).then((res) => {
                    if (res.data.code == 10000) {
                        // console.log(res.data)
                        _this.examRow = row
                        _this.examResSelection = res.data.data.selection.examResSelection
                        _this.examRebackSelection = res.data.data.selection.examRebackSelection
                        _this.examForm = Object.assign({}, res.data.data.exam)
                        _this.examVisible = true
                        _this.examTitle = '业务审核'
                    } else {
                        _this.$message({
                            showClose: false,
                            message: res.data.message,
                            type: 'error'
                        })
                    }
                }).catch(() => {
                    _this.$message({
                        showClose: false,
                        message: '获取审核信息失败！',
                        type: 'error'
                    })
                })
            },
            // 审核窗口关闭前动作
            handleCloseBindExam() {
                this.examVisible = false
                this.examTitle = ''
                this.examRow = {}
            },
            // 审核及审核提交动作
            jobExamedSaveOrSubmit(saveOrSubmit) {
                let _this = this
                _this.$refs['examForm'].validate((valid) => {
                    if (valid) {
                        let params = {
                            processId: _this.examRow.processId,
                            jobId: _this.examRow.jobId,
                            flowId: _this.examRow.flowId,
                            nodeId: _this.examRow.nodeId
                        }
                        params['exam'] = _this.examForm
                        params['saveOrSubmit'] = saveOrSubmit

                        let _examSaveOrSubmitAction = function() {
                            _this.axios.post(api.jobExamOrSubmitWorkFlow, params).then((res) => {
                                if (res.data.code == 10000) {
                                    _this.getTableList()
                                    _this.examRow = {}
                                    _this.examVisible = false
                                    _this.examTitle = ''
                                } else {
                                    _this.$message({
                                        showClose: false,
                                        message: res.data.message,
                                        type: 'error'
                                    });
                                }
                            }).catch((err) => {
                                console.log('调用失败', err)
                            })
                        }

                        if (saveOrSubmit === 1) {
                            let confirmMsg = '';
                            if (typeof _this.examRow.NUMBER === undefined || typeof _this.examRow.NUMBER === 'undefined') {
                                confirmMsg = '是否确认审核并提交该订单?';
                            } else {
                                confirmMsg = '是否确认审核并提交该订单#' + _this.examRow.NUMBER + '?';
                            }
                            _this.$confirm(confirmMsg, '提示', {
                                confirmButtonText: '确定',
                                cancelButtonText: '取消',
                                type: 'warning'
                            }).then(() => {
                                _examSaveOrSubmitAction()
                            }).catch(() => {});
                        } else {
                            _examSaveOrSubmitAction()
                        }
                    } else {
                        return false;
                    }
                });
            },
            // 提交
            jobSubmited(row) {
                let url = api.jobProcessSubmit,
                    params = {
                        processId: row.processId,
                        jobId: row.jobId,
                        flowId: row.flowId,
                        nodeId: row.nodeId,
                    }
                let _this = this
                let confirmMsg = '';
                if (typeof row.NUMBER === undefined || typeof row.NUMBER === 'undefined') {
                    confirmMsg = '是否确认提交该订单?';
                } else {
                    confirmMsg = '是否确认提交该订单#' + row.NUMBER + '?';
                }

                _this.$confirm(confirmMsg, '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    _this.handleAxiosFun(url, params)
                }).catch(() => {});
            },
            // 打印
            jobPrinted(row, uuId) {
                let _this = this,
                    params = {
                        flowId: row.flowId,
                        jobId: row.jobId,
                        uuId: uuId,
                    }

                _this.axios.post(api.printJobDetailByUuid, params, {
                    responseType: 'blob'
                }).then(response => {
                    let data = response.data
                    // console.log(data)
                    let fileReader = new FileReader();
                    fileReader.onload = function() {
                        try {
                            let jsonData = JSON.parse(this.result);
                            _this.$message({
                                showClose: false,
                                message: jsonData.message,
                                type: 'info'
                            })
                        } catch (err) {
                            let blob = new Blob([response.data], {
                                type: 'application/vnd.ms-excel;charset=utf-8'
                            })
                            let filename = decodeURI(response.headers['content-disposition'].split('=')[1])
                                .replace(/^"*|"*$/g, '')
                            if ('download' in document.createElement('a')) { // 非IE下载
                                const elink = document.createElement('a')
                                elink.download = filename
                                elink.style.display = 'none'
                                elink.href = URL.createObjectURL(blob)
                                document.body.appendChild(elink)
                                elink.click()
                                document.body.removeChild(elink)
                                window.URL.revokeObjectURL(elink.href) //释放掉blob对象
                            } else { // IE10+下载
                                navigator.msSaveBlob(blob, filename)
                            }
                        }
                    };
                    fileReader.readAsText(data)
                }).catch((err) => {
                    console.log(err)
                    _this.$message({
                        showClose: false,
                        message: '打印失败',
                        type: 'error'
                    })
                })
            },
            // 导出
            jobExported() {
                let _this = this,
                    params = {
                        flowId: this.flowId,
                        nodeId: this.nodeId,
                    }

                _this.axios.post(api.exportJobListByNodeId, params, {
                    responseType: 'blob'
                }).then(response => {
                    let data = response.data
                    // console.log(data)
                    let fileReader = new FileReader();
                    fileReader.onload = function() {
                        try {
                            let jsonData = JSON.parse(this.result);
                            _this.$message({
                                showClose: false,
                                message: jsonData.message,
                                type: 'info'
                            })
                        } catch (err) {
                            let blob = new Blob([response.data], {
                                type: 'application/vnd.ms-excel;charset=utf-8'
                            })
                            let filename = decodeURI(response.headers['content-disposition'].split('=')[1])
                                .replace(/^"*|"*$/g, '')
                            if ('download' in document.createElement('a')) { // 非IE下载
                                const elink = document.createElement('a')
                                elink.download = filename
                                elink.style.display = 'none'
                                elink.href = URL.createObjectURL(blob)
                                document.body.appendChild(elink)
                                elink.click()
                                document.body.removeChild(elink)
                                window.URL.revokeObjectURL(elink.href) //释放掉blob对象
                            } else { // IE10+下载
                                navigator.msSaveBlob(blob, filename)
                            }
                        }
                    };
                    fileReader.readAsText(data)
                }).catch((err) => {
                    console.log(err)
                    _this.$message({
                        showClose: false,
                        message: '导出失败',
                        type: 'error'
                    })
                })
            },
            async jobEdited(row) {
                this.$set(this, 'jobObj', {})
                console.log('1',this.jobObj)
                let msgTitle = '';
                if (typeof row.NUMBER === undefined || typeof row.NUMBER === 'undefined') {
                    msgTitle = '编辑';
                } else {
                    msgTitle = '编辑#' + row.NUMBER;
                }
                
                let _this = this
                _this.axios.post(api.getJobDataDetail, {
                    jobId: row.jobId,
                    flowId: row.flowId,
                    nodeId: row.nodeId,
                }).then((res) => {
                    if (res.data.code == 10000) {
                        _this.jobRow = row
                        // _this.jobObj = Object.assign({}, res.data.data)
                        _this.jobObj = res.data.data
                        console.log('2',this.jobObj)
                        // _this.jobVisible = true
                        // _this.jobTitle = msgTitle
                        _this.jobViewTag = 1
                        // 获取表单配置信息
                        _this.getJobFormDefaultConfig(row.flowId, row.nodeId, msgTitle)
                    } else {
                        _this.jobRow = {}
                        _this.jobObj = {}
                        _this.$message({
                            showClose: false,
                            message: res.data.message,
                            type: 'error'
                        })
                    }
                }).catch(() => {
                    _this.jobRow = {}
                    _this.jobObj = {}
                    _this.$message({
                        showClose: false,
                        message: '获取审核信息失败！',
                        type: 'error'
                    })
                })
            },
            async jobViewed(row) {
                this.$set(this, 'jobObj', {})
                let msgTitle = '';
                if (typeof row.NUMBER === undefined || typeof row.NUMBER === 'undefined') {
                    msgTitle = '查看';
                } else {
                    msgTitle = '查看#' + row.NUMBER;
                }

                let _this = this
                _this.axios.post(api.getJobDataDetail, {
                    jobId: row.jobId,
                    flowId: row.flowId,
                    nodeId: row.nodeId,
                }).then((res) => {
                    if (res.data.code == 10000) {
                        // console.log(res.data.data)
                        _this.jobRow = row
                        // _this.jobObj = Object.assign({}, res.data.data)
                        _this.jobObj = res.data.data
                        // _this.jobVisible = true
                        // _this.jobTitle = msgTitle
                        _this.jobViewTag = 0
                        // 获取表单配置信息
                        _this.getJobFormDefaultConfig(row.flowId, row.nodeId, msgTitle)
                    } else {
                        _this.jobRow = {}
                        _this.jobObj = {}
                        _this.$message({
                            showClose: false,
                            message: res.data.message,
                            type: 'error'
                        })
                    }
                }).catch(() => {
                    _this.jobRow = {}
                    _this.jobObj = {}
                    _this.$message({
                        showClose: false,
                        message: '暂无详情表单！',
                        type: 'error'
                    })
                })
            },
            handleCloseBindJob() {
                this.jobVisible = false
                this.jobTitle = ''
                this.jobRow = {}
                this.jobObj = {}
                this.jobOption = {
                    emptyBtn: false,
                    submitBtn: false
                }
                this.jobCurrentConfig = {}
                this.jobFormConfigs = []
                this.jobHackReset = false
                this.$nextTick(() => {
                    this.jobHackReset = true
                })
                this.getTableList()
            },
            jobFormChange(formId) {
                let _this = this
                _this.axios.post(api.getJobFormConfigByFormId, {
                    formId: formId,
                }).then((res) => {
                    if (res.data.code == 10000) {
                        _this.jobOption = Object.assign({}, res.data.data)
                        
                        if (_this.jobViewTag === 0) {
                            _this.jobOption['detail'] = true
                        } else {
                            if (res.data.data.length === 0) {
                                _this.jobOption['emptyBtn'] = false
                                _this.jobOption['submitBtn'] = false
                            }
                            _this.jobOption['detail'] = false
                        }
                        _this.jobHackReset = false
                        _this.$nextTick(() => {
                            _this.jobHackReset = true
                        })
                    } else {
                        _this.jobOption = {
                            emptyBtn: false,
                            submitBtn: false
                        }
                    }
                }).catch(() => {
                    _this.jobOption = {
                        emptyBtn: false,
                        submitBtn: false
                    }
                })
            },
            getJobFormDefaultConfig(flowId, nodeId, msgTitle) {
                let _this = this
                _this.axios.post(api.getJobFormDefaultConfig, {
                    flowId: flowId,
                    nodeId: nodeId,
                }).then((res) => {
                    if (res.data.code == 10000) {
                        console.log(res.data.data)
                        if (res.data.data.length === 0) {
                            _this.jobOption = {
                                emptyBtn: false,
                                submitBtn: false
                            }
                            _this.jobCurrentConfig = {}
                            _this.jobFormConfigs = []
                            _this.jobVisible = false
                            _this.jobTitle = ''
                            _this.$message({
                                showClose: false,
                                message: '暂无详情表单！',
                                type: 'info'
                            })
                            return false
                        }
                        _this.jobVisible = true
                        _this.jobTitle = msgTitle
                        
                        _this.jobOption = Object.assign({}, res.data.data.default)
                        _this.jobCurrentConfig = Object.assign({}, res.data.data.currentConfig)
                        _this.jobFormConfigs = res.data.data.formConfigs
                        if (_this.jobViewTag === 0) {
                            _this.jobOption['detail'] = true
                        } else {
                            _this.jobOption['detail'] = false
                        }
                        
                        
                        _this.jobHackReset = false
                        _this.$nextTick(() => {
                            _this.jobHackReset = true
                        })
                    } else {
                        _this.jobOption = {
                            emptyBtn: false,
                            submitBtn: false
                        }
                    }
                }).catch(() => {
                    _this.jobOption = {
                        emptyBtn: false,
                        submitBtn: false
                    }
                })
            },
            jobProcessSaveOrSubmit(saveOrSubmit) {
                let _this = this
                let params = {}
                params['main'] = _this.jobObj
                params['jobId'] = _this.jobRow.jobId || ''
                params['flowId'] = _this.jobRow.flowId || _this.flowId
                params['nodeId'] = _this.jobRow.nodeId || _this.nodeId
                params['saveOrSubmit'] = saveOrSubmit
                console.log(params)
                console.log('3',_this.jobObj)
                // return;
                let _jobSaveOrSubmitAction = function() {
                    _this.axios.post(api.jobCommitOrSaveOfWorkFlow, params).then((res) => {
                        if (res.data.code == 10000) {
                            _this.$message({
                                showClose: false,
                                message: res.data.message,
                                type: 'success'
                            });
                            // do something
                            _this.axios.post(api.getJobDataDetail, {
                                jobId: res.data.data.jobId,
                                flowId: _this.flowId,
                                nodeId: _this.nodeId,
                            }).then((result) => {
                                if (result.data.code == 10000) {
                                    // console.log(res.data.data)
                                    // 保存，提交
                                    if (saveOrSubmit === 1) {
                                        // 关闭窗口
                                        _this.handleCloseBindJob()
                                    } else {
                                        _this.jobRow = {
                                            jobId: res.data.data.jobId,
                                            flowId: _this.flowId,
                                            nodeId: _this.nodeId,
                                            NUMBER: result.data.data.NUMBER
                                        }
                                        _this.jobObj = Object.assign({}, result.data.data)
                                        console.log('4',_this.jobObj)
                                        _this.jobViewTag = 1
                                    }
                                }
                            }).catch(() => {})
                        } else {
                            _this.$message({
                                showClose: false,
                                message: res.data.message,
                                type: 'error'
                            });
                        }
                    }).catch((err) => {
                        console.log(err)
                        _this.$message({
                            showClose: false,
                            message: '网络异常',
                            type: 'error'
                        });
                    })
                }
                
                if (saveOrSubmit === 1) {
                    let confirmMsg = ''
                    if (typeof _this.jobRow.NUMBER === undefined || typeof _this.jobRow.NUMBER === 'undefined') {
                        confirmMsg = '是否确认保存并提交该订单?'
                    } else {
                        confirmMsg = '是否确认保存并提交该订单#' + _this.jobRow.NUMBER + '?'
                    }
                    _this.$confirm(confirmMsg, '提示', {
                        confirmButtonText: '确定',
                        cancelButtonText: '取消',
                        type: 'warning'
                    }).then(() => {
                        _jobSaveOrSubmitAction()
                    }).catch(() => {});
                } else {
                    _jobSaveOrSubmitAction()
                }
            },
            jobCharted(row) {
                console.log('jobCharted')
            },
            // axios接口请求
            handleAxiosFun(url, params, _sucess_callback, _fail_callback) {
                let _this = this

                _this.axios.post(url, params).then((res) => {
                    if (res.data.code == 10000) {
                        _this.$message({
                            showClose: false,
                            message: res.data.message,
                            type: 'success'
                        });
                        if (_sucess_callback && typeof _sucess_callback === 'function') {
                            _sucess_callback()
                        } else {
                            _this.getTableList()
                        }
                    } else {
                        _this.$message({
                            showClose: false,
                            message: res.data.message,
                            type: 'error'
                        });
                        if (_fail_callback && typeof _fail_callback === 'function') {
                            _fail_callback()
                        }
                    }
                }).catch(() => {
                    _this.$message({
                        showClose: false,
                        message: '调用失败',
                        type: 'error'
                    });
                })
            }
        }
    }
</script>

<style lang="scss">
    .avue-crud__right {
        position: relative;
    }

    .fast-search {
        position: absolute;
        right: 218px;
    }
</style>
